ImageGear Recognition API allows saving recognized data to a number of simple text and XML formats. Use IG_REC_output_direct_text_write function to write recognized data of several HIG_REC_IMAGE objects to a simple text or XML file. Use IG_REC_output_text_format_get/IG_REC_output_text_format_set functions to get or set the format for saving. The following formats are available:
- Simple Text
- Comma Separated Text, which can be used to represent tables
- Formatted Text, which delivers plain text, but attempts to keep layout (columns and boxes) as detected in the original image using tabulators
- Simple XML with letter coordinates, which is typically used for further processing recognized data. You can easily parse (e.g., MSXML) or transform (XSLT) the output xml file. The format of the xml output is specified by the same scheme as the Layout Retention Xml Output (http://www.nuance.com/omnipage/xml/ssdoc-schema3.xsd).
The following example loads an image file, recognizes it, and outputs it as formatted text.
Saving the Recognized Data Directly in the Text Format
C | Copy Code |
---|---|
AT_ERRCOUNT nErrCount; HIGEAR hIGear; HIG_REC_IMAGE hImg; nErrCount = IG_load_file("Image.tif", &hIGear ); nErrCount = IG_REC_image_import(hIGear, &hImg); nErrCount = IG_image_delete(hIGear); nErrCount = IG_REC_image_recognize(hImg); nErrCount = IG_REC_output_codepage_set("Windows ANSI"); nErrCount = IG_REC_output_text_format_set(IG_REC_DTXT_TXTF); nErrCount = IG_REC_output_direct_text_write(&hImg, 1, "ONEPAGE.txt"); //... nErrCount = IG_REC_image_delete(hImg); |